import xlwings as xw

global Value

"""
excel3.Value = result
excel3.XLWINGS(list_val[0], list_val[1])
"""

def XLWINGS(KeShi, GuiGe):
  if KeShi == "影像科" and GuiGe == "14INX17IN":
    Zoophobia = "B"
  elif KeShi == "放射科" and GuiGe == "11INX14IN":
    Zoophobia = "D"
  elif KeShi == "放射科" and GuiGe == "14INX17IN":
    Zoophobia = "E"
  elif KeShi == "影像科彩打" and GuiGe == "13INX17IN":
    Zoophobia = "C"
  elif KeShi == "体检" and GuiGe == "11INX14IN":
    Zoophobia = "G"
  filename = 'C:/Users/Administrator/Desktop/New.xls'
  app = xw.App(visible=False, add_book=False)
  # app.screen_updating = True
  wb = app.books.open(filename)
  sheet = wb.sheets[0]
  print(sheet)

  sheet.range(f'{Zoophobia}7:{Zoophobia}36').options(transpose=True).value = Value

  wb.save()
  app.kill()

# XLWINGS("放射科", "11INX14IN")
